<?php
namespace WeChat;
/**
 * ---------------------------------------------------------------------------------------------------------------------
 * 动态对象静态化调用接口父类,用于实现Facade的设计模式
 * ---------------------------------------------------------------------------------------------------------------------
 * @author		Hismer <odaytudio@gmail.com>
 * @since		2014-11-05
 * @copyright	Copyright (c) 2014-2015 Swiftx Inc.
 * ---------------------------------------------------------------------------------------------------------------------
 */
abstract class Facade extends Connector {

	const SnsApiUserInfo = 'snsapi_userinfo';
	const SnsApiBase = 'snsapi_base';
	protected static $_Connector;

	/**
	 * 获取对象
	 * @return Connector
	 */
	public static function Fetch(){
		$classname = static::class;
		if(!isset(static::$_Connector[$classname]))
			static::$_Connector[$classname] = new $classname();
		return static::$_Connector[$classname];
	}

	/**
	 * 获取JsSdk对象
	 * @param $url
	 * @return JsSdk
	 */
	public static function JsSdk($url){
		return static::Fetch()->MakeJsSdk($url);
	}

}
